package com.ithuaxin.array;

import java.util.Scanner;

public class Test11 {
    public static void main(String[] args) {
        int arr1[] = {12,14,23,45,66,68,70,77,90,91};
        int arr2[] = new int[arr1.length + 1];
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个整数");
        int a = sc.nextInt();
        int b = a;
        for (int i = 0; i < arr2.length-1; i++) {
            if (a < arr1[i]){
                arr2[i] = a;
                a = arr1[i];
            }else{
                arr2[i] = arr1[i];
            }
        }
        if (a!=b){
            arr2[arr2.length-1] = arr1[arr1.length-1];
        }
        else{
            arr2[arr2.length-1] = a;
        }
        for (int i = 0; i < arr2.length; i++) {
            System.out.print(arr2[i] + " ");
        }
    }
}
